﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text.RegularExpressions;

namespace Bizu.modul
{
    public class modulPost
    {
        public static string convertPostContent(string html)
        {
            html = html.Replace("[hr]", "<hr/>");
            html = html.Replace("[br]", "<br/>");
            html = Regex.Replace(html, @"\[img\](.*?)\[/img\]", "<a href='$1'><img src='$1' /></a>", RegexOptions.IgnoreCase);
            html = Regex.Replace(html, @"\[b\](.*?)\[/b\]", "<b>$1</b>", RegexOptions.IgnoreCase);
            html = Regex.Replace(html, @"\[i\](.*?)\[/i\]", "<i>$1</i>", RegexOptions.IgnoreCase);
            html = Regex.Replace(html, @"\[u\](.*?)\[/u\]", "<u>$1</u>", RegexOptions.IgnoreCase);
            html = Regex.Replace(html, @"\[url\](.*?)\[/url\]", "<a href='$1'>$1</a>", RegexOptions.IgnoreCase);
            html = Regex.Replace(html, @"\[youtube\](.*?)\[/youtube\]", "<iframe width=\"500\" height=\"315\" src=\"http://www.youtube.com/embed/$1?rel=0\" frameborder=\"0\" allowfullscreen></iframe>", RegexOptions.IgnoreCase);

            return html;
        }
    }
}